package com.xz.group12306.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.xz.group12306.business.service.ManagerService;
import com.xz.group12306.business.service.impl.ManagerServiceImpl;
import com.xz.group12306.domain.User;

/**
 * 管理员对相应的用户信息进行修改的Servlet 张爱文
 */
@WebServlet("/ManagerUpdateSServlet")
public class ManagerUpdateSServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * 构造方法
	 */
	public ManagerUpdateSServlet() {
		super();
	}

	/**
	 * doGet()方法
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request, response);
	}

	/**
	 * doPost()方法
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		/**
		 * 获取UserService的实例(对象)
		 */
		ManagerService managerService=new ManagerServiceImpl();
		PrintWriter out = response.getWriter();

		/**
		 * 获取表单要提交的数据
		 */
		String id = request.getParameter("id");
		String userName = request.getParameter("username");
		String cert = request.getParameter("cert");

		
		
		System.out.println(userName);
		System.out.println(cert);

        /**
         * 将过去到的数据封装成user对象
         */
		User user = new User();
		user.setId(Integer.parseInt(id));
		user.setUsername(userName);
		user.setCert(cert);
		
		/**
		 * 执行findUserListUpdate()方法
		 * 进行用户数据的更新  用户数据的查询
		 */
		List<User> users = managerService.findUserListUpdate(user);
		
		/**
		 * 创建一个会话 
		 * 传 获取到的user对象
		 */
		
	}

}
